%module OgrePass

%{
#include "OGRE/OgrePass.h"
	%}

%import "OgrePrerequisites.i"
 //#include "OgreGpuProgram.h"
%import "OgreColourValue.i"
%import "OgreBlendMode.i"
%import "OgreCommon.i"
%import "OgreLight.i"
%import "OgreTextureUnitState.i"
 //#include "OgreUserObjectBindings.h"

 //%import "OgreTechnique.i"

namespace Ogre {

	class Technique;

	enum IlluminationStage
	{
		/// Part of the rendering which occurs without any kind of direct lighting
		IS_AMBIENT,
		/// Part of the rendering which occurs per light
		IS_PER_LIGHT,
		/// Post-lighting rendering
		IS_DECAL, 
		/// Not determined
		IS_UNKNOWN
	};

	class Pass //: public PassAlloc
    {
	public:
		struct HashFunc
		{
			virtual uint32 operator()(const Pass* p) const = 0;
			virtual ~HashFunc() {}
		};

//		typedef set<Pass*>::type PassSet;

		Pass(Technique* parent, unsigned short index);

		Pass(Technique* parent, unsigned short index, const Pass& oth );

		Pass& operator=(const Pass& oth);
		virtual ~Pass();


		bool isProgrammable(void) const;


        bool hasVertexProgram(void) const { return mVertexProgramUsage != NULL; }

        bool hasFragmentProgram(void) const { return mFragmentProgramUsage != NULL; }

        bool hasGeometryProgram(void) const { return mGeometryProgramUsage != NULL; }

        bool hasShadowCasterVertexProgram(void) const { return mShadowCasterVertexProgramUsage != NULL; }

        bool hasShadowCasterFragmentProgram(void) const { return mShadowCasterFragmentProgramUsage != NULL; }

        bool hasShadowReceiverVertexProgram(void) const { return mShadowReceiverVertexProgramUsage != NULL; }

        bool hasShadowReceiverFragmentProgram(void) const { return mShadowReceiverFragmentProgramUsage != NULL; }

        unsigned short getIndex(void) const { return mIndex; }

        void setName(const String& name);

        const String& getName(void) const { return mName; }

        void setAmbient(Real red, Real green, Real blue);

        void setAmbient(const ColourValue& ambient);

        void setDiffuse(Real red, Real green, Real blue, Real alpha);

        void setDiffuse(const ColourValue& diffuse);

        void setSpecular(Real red, Real green, Real blue, Real alpha);

        void setSpecular(const ColourValue& specular);

        void setShininess(Real val);


        void setSelfIllumination(Real red, Real green, Real blue);

        void setEmissive(Real red, Real green, Real blue);

        void setSelfIllumination(const ColourValue& selfIllum);

        void setEmissive(const ColourValue& emissive);

//        void setVertexColourTracking(TrackVertexColourType tracking);

        Real getPointSize(void) const;

	void setPointSize(Real ps);

	void setPointSpritesEnabled(bool enabled);

	bool getPointSpritesEnabled(void) const;

	void setPointAttenuation(bool enabled,
			Real constant = 0.0f, Real linear = 1.0f, Real quadratic = 0.0f);

		bool isPointAttenuationEnabled(void) const;


		Real getPointAttenuationConstant(void) const;

		Real getPointAttenuationLinear(void) const;

		Real getPointAttenuationQuadratic(void) const;

		void setPointMinSize(Real min);

		Real getPointMinSize(void) const;

		void setPointMaxSize(Real max);

		Real getPointMaxSize(void) const;

        const ColourValue& getAmbient(void) const;

        const ColourValue& getDiffuse(void) const;

        const ColourValue& getSpecular(void) const;

        const ColourValue& getSelfIllumination(void) const;

        const ColourValue& getEmissive(void) const;

        Real getShininess(void) const;

//        TrackVertexColourType getVertexColourTracking(void) const;

//        TextureUnitState* createTextureUnitState(void);

//        TextureUnitState* createTextureUnitState( const String& textureName, unsigned short texCoordSet = 0);

//		void addTextureUnitState(TextureUnitState* state);

//        TextureUnitState* getTextureUnitState(unsigned short index);

//        TextureUnitState* getTextureUnitState(const String& name);

//		const TextureUnitState* getTextureUnitState(unsigned short index) const;

//		const TextureUnitState* getTextureUnitState(const String& name) const;

//        unsigned short getTextureUnitStateIndex(const TextureUnitState* state) const;

//        typedef VectorIterator<TextureUnitStates> TextureUnitStateIterator;

//        TextureUnitStateIterator getTextureUnitStateIterator(void);

//		typedef ConstVectorIterator<TextureUnitStates> ConstTextureUnitStateIterator;

//		ConstTextureUnitStateIterator getTextureUnitStateIterator(void) const;

//        void removeTextureUnitState(unsigned short index);

//        void removeAllTextureUnitStates(void);

//        unsigned short getNumTextureUnitStates(void) const;

//        void setSceneBlending( const SceneBlendType sbt );

//        void setSeparateSceneBlending( const SceneBlendType sbt, const SceneBlendType sbta );

//        void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);

//		void setSeparateSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha );

//	bool hasSeparateSceneBlending() const;

//        SceneBlendFactor getSourceBlendFactor() const;

//        SceneBlendFactor getDestBlendFactor() const;

//	SceneBlendFactor getSourceBlendFactorAlpha() const;

//	SceneBlendFactor getDestBlendFactorAlpha() const;

//	void setSceneBlendingOperation(SceneBlendOperation op);

//		void setSeparateSceneBlendingOperation(SceneBlendOperation op, SceneBlendOperation alphaOp);

//	bool hasSeparateSceneBlendingOperations() const;

//	SceneBlendOperation getSceneBlendingOperation() const;

//	SceneBlendOperation getSceneBlendingOperationAlpha() const;

	bool isTransparent(void) const;

        void setDepthCheckEnabled(bool enabled);

        bool getDepthCheckEnabled(void) const;

        bool getDepthWriteEnabled(void) const;

//        void setDepthFunction( CompareFunction func );

//        CompareFunction getDepthFunction(void) const;

	void setColourWriteEnabled(bool enabled);

	bool getColourWriteEnabled(void) const;

        void setCullingMode( CullingMode mode );

        CullingMode getCullingMode(void) const;

        void setManualCullingMode( ManualCullingMode mode );

        ManualCullingMode getManualCullingMode(void) const;

        void setLightingEnabled(bool enabled);

        bool getLightingEnabled(void) const;

        void setMaxSimultaneousLights(unsigned short maxLights);

        unsigned short getMaxSimultaneousLights(void) const;

	void setStartLight(unsigned short startLight);

	unsigned short getStartLight(void) const;

	void setLightMask(uint32 mask);

	uint32 getLightMask() const;

        void setShadingMode( ShadeOptions mode );

        ShadeOptions getShadingMode(void) const;

	void setPolygonMode( PolygonMode mode );

	PolygonMode getPolygonMode(void) const;

	virtual void setPolygonModeOverrideable(bool override);

	virtual bool getPolygonModeOverrideable(void) const;

        void setFog(
            bool overrideScene,
            FogMode mode = FOG_NONE,
            const ColourValue& colour = ColourValue::White,
            Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );

        bool getFogOverride(void) const;

        FogMode getFogMode(void) const;

        const ColourValue& getFogColour(void) const;

        Real getFogStart(void) const;

        Real getFogEnd(void) const;


        Real getFogDensity(void) const;

        void setDepthBias(float constantBias, float slopeScaleBias = 0.0f);

        float getDepthBiasConstant(void) const;

	float getIterationDepthBias() const;

//        void setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverageEnabled = false);

//	void setAlphaRejectFunction(CompareFunction func);

	void setAlphaRejectValue(unsigned char val);

//	CompareFunction getAlphaRejectFunction(void) const { return mAlphaRejectFunc; }

	unsigned char getAlphaRejectValue(void) const { return mAlphaRejectVal; }

	void setAlphaToCoverageEnabled(bool enabled);

	bool isAlphaToCoverageEnabled() const { return mAlphaToCoverageEnabled; }

        void setTransparentSortingEnabled(bool enabled);

        void setTransparentSortingForced(bool enabled);

	bool getTransparentSortingForced(void) const;

	bool getIteratePerLight(void) const { return mIteratePerLight; }

        bool getRunOnlyForOneLightType(void) const { return mRunOnlyForOneLightType; }

        Light::LightTypes getOnlyLightType() const { return mOnlyLightType; }

	void setLightCountPerIteration(unsigned short c);

	unsigned short getLightCountPerIteration(void) const;
		
        Technique* getParent(void) const { return mParent; }

	const String& getResourceGroup(void) const;

//	void setVertexProgram(const String& name, bool resetParams = true);

//	void setVertexProgramParameters(GpuProgramParametersSharedPtr params);

	const String& getVertexProgramName(void) const;

//        GpuProgramParametersSharedPtr getVertexProgramParameters(void) const;

//	const GpuProgramPtr& getVertexProgram(void) const;

        void setShadowCasterVertexProgram(const String& name);

//        void setShadowCasterVertexProgramParameters(GpuProgramParametersSharedPtr params);

        const String& getShadowCasterVertexProgramName(void) const;

//        GpuProgramParametersSharedPtr getShadowCasterVertexProgramParameters(void) const;

//        const GpuProgramPtr& getShadowCasterVertexProgram(void) const;

        void setShadowCasterFragmentProgram(const String& name);

//        void setShadowCasterFragmentProgramParameters(GpuProgramParametersSharedPtr params);

        const String& getShadowCasterFragmentProgramName(void) const;

//        GpuProgramParametersSharedPtr getShadowCasterFragmentProgramParameters(void) const;

//        const GpuProgramPtr& getShadowCasterFragmentProgram(void) const;

        void setShadowReceiverVertexProgram(const String& name);

//        void setShadowReceiverVertexProgramParameters(GpuProgramParametersSharedPtr params);

	void setShadowReceiverFragmentProgram(const String& name);

//        void setShadowReceiverFragmentProgramParameters(GpuProgramParametersSharedPtr params);

        const String& getShadowReceiverVertexProgramName(void) const;

//        GpuProgramParametersSharedPtr getShadowReceiverVertexProgramParameters(void) const;

//        const GpuProgramPtr& getShadowReceiverVertexProgram(void) const;

	const String& getShadowReceiverFragmentProgramName(void) const;

//		GpuProgramParametersSharedPtr getShadowReceiverFragmentProgramParameters(void) const;

//		const GpuProgramPtr& getShadowReceiverFragmentProgram(void) const;

	void setFragmentProgram(const String& name, bool resetParams = true);

//	void setFragmentProgramParameters(GpuProgramParametersSharedPtr params);

	const String& getFragmentProgramName(void) const;

//	GpuProgramParametersSharedPtr getFragmentProgramParameters(void) const;

//	const GpuProgramPtr& getFragmentProgram(void) const;

	void setGeometryProgram(const String& name, bool resetParams = true);

//	void setGeometryProgramParameters(GpuProgramParametersSharedPtr params);

	const String& getGeometryProgramName(void) const;

//	GpuProgramParametersSharedPtr getGeometryProgramParameters(void) const;

//	const GpuProgramPtr& getGeometryProgram(void) const;

	Pass* _split(unsigned short numUnits);

        bool isLoaded(void) const;

        uint32 getHash(void) const { return mHash; }

        void setTextureFiltering(TextureFilterOptions filterType);

        void setTextureAnisotropy(unsigned int maxAniso);

	void setNormaliseNormals(bool normalise) { mNormaliseNormals = normalise; }

	bool getNormaliseNormals(void) const {return mNormaliseNormals; }

//	static const PassSet& getDirtyHashList(void);

//        static const PassSet& getPassGraveyard(void);

//	static void clearDirtyHashList(void);

        static void processPendingPassUpdates(void);

        void queueForDeletion(void);

        bool isAmbientOnly(void) const;

        void setPassIterationCount(const size_t count) { mPassIterationCount = count; }

        size_t getPassIterationCount(void) const { return mPassIterationCount; }

//        bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const;

	void setLightScissoringEnabled(bool enabled) { mLightScissoring = enabled; }

	bool getLightScissoringEnabled() const { return mLightScissoring; }

	void setLightClipPlanesEnabled(bool enabled) { mLightClipPlanes = enabled; }

	bool getLightClipPlanesEnabled() const { return mLightClipPlanes; }

//	void setIlluminationStage(IlluminationStage is) { mIlluminationStage = is; }

//	IlluminationStage getIlluminationStage() const { return mIlluminationStage; }

		enum BuiltinHashFunction
		{
			/** Try to minimise the number of texture changes. */
			MIN_TEXTURE_CHANGE,
			/** Try to minimise the number of GPU program changes.
			@note Only really useful if you use GPU programs for all of your
				materials. 
			*/
			MIN_GPU_PROGRAM_CHANGE
		};

		static void setHashFunction(BuiltinHashFunction builtin);

//		static void setHashFunction(HashFunc* hashFunc) { msHashFunc = hashFunc; }

//		static HashFunc* getHashFunction(void) { return msHashFunc; }

//		static HashFunc* getBuiltinHashFunction(BuiltinHashFunction builtin);

//		UserObjectBindings&	getUserObjectBindings() { return mUserObjectBindings; }

//		const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
    };
}
